/**
 * 将url params 参数转为 object
 * @param {*} url 
 * @returns 
 */
export function stringUrlToObj(url) {
  const search = url.split('?')[1]
  if (!search) {
    return {}
  }
  return JSON.parse(
    '{"' +
      decodeURIComponent(search)
        .replace(/"/g, '\\"')
        .replace(/&/g, '","')
        .replace(/=/g, '":"')
        .replace(/\+/g, ' ') +
      '"}'
  )
}

/**
 * 反转字符串
 * @export
 * @param {*} str
 * @returns
 */
export function stringReverse(str) {
  let arr = str.split("")
  arr.reverse()
  let s = arr.join("")
  return s
}
